<template>
	<view>
		<view class="an-notice-box" :style="'background-color: '+bgColor+';'">
			<!-- <scroll-view class="an-notice-content"> -->
				<!-- <swiper v-if="show" class="swiper" :autoplay="true" :disable-touch="true" :interval="switchTime*1000" :duration="1500" :circular="true" :vertical="true"> -->
					<!-- <swiper-item v-for="(text, index) in text" :key="index" class="an-notice-content-item"> -->
						<view class="swiper-item">
							<text class="an-notice-content-item-text" :style="'color: '+color+';'">
								{{text}}
							</text>
						</view>
					<!-- </swiper-item> -->
				<!-- </swiper> -->
			<!-- </scroll-view> -->
			
		</view>
	</view>
</template>

<script>
	export default {
		props:{
			text: {
				type: String,
				default: ["暂无未读消息"]
			}, 
			color: {
				type: String,
				default: '#FF8A00'
			},
			bgColor: {
				type: String,
				default: 'transparent'
			},
			switchTime: {
				type: Number,
				default: 3
			},

		},
		data() {
			return {
				number: 0,
				list: [],
				copyText: '',
				show: '',
			};
		},
		mounted() {
			// this.list = this.text.split('|');
			// console.log(this.list.length)
			// if(this.text.length > 1){
			// 	this.showSerial = true;
			// }
			this.list = this.text;
			this.show = true;
			/* this.number = 0;
			this.startMove(); */
		},
		watch: {
			
		},
		methods: {			
			/* startMove () {
			  // eslint-disable-next-line
			  let timer = setTimeout(() => {
				if (this.number === this.list.length-1) {
				  this.number = 0;
				} else {
				  this.number += 1;
				}
				this.startMove();
			  }, this.switchTime*1000);
			}, */
			more(){
				this.show = false;
				this.$emit('more')
			}
		}
	}
</script>

<style>
	.swiper{
		height: 60upx!important;
	}
	.an-notice-box{
		width: 100%; 
		height: 100%;
		overflow: hidden; 
		display: flex; 
		justify-content: flex-start;
	}
	.an-notice-content{
		position: relative; 
		font-size: 24rpx;
	}
	.an-notice-content-item{
		padding-left: 20rpx;
		width: 100%; 
		height: 100%; 
		text-align: left; 
	}
	.an-notice-content-item-text{
		display: block; 
		white-space: nowrap; 
		text-overflow: ellipsis; 
		overflow: hidden;
		font-size: 24rpx;
	}
	@keyframes anotice {
		 0%  {transform: translateY(100%);}
	    30%  {transform: translateY(0);}
	    70%  {transform: translateY(0);}
	   100%  {transform: translateY(-100%);}
	}
</style>
